/*
Author: Surpass-HC
Source: https://gitee.com/hxchuan000/clpc-1
Mail: surpass-hc@qq.com
*/
#ifndef __LIGHT_PROTOCOL_FUNCTION_INTERFACE_H__
#define __LIGHT_PROTOCOL_FUNCTION_INTERFACE_H__
#include <clptcConfig.h>
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
#include <lxMessege.h>
#include <lxShmOpt.h>
#endif
// struct clptcDlgMgrStc;
typedef struct
{
    void *lpDlgMgr; // clptcDlgMgrStc, connecter dialog manager.
    void *lpPkrPsr; // clptcParseStc, protocol packer and parse
    // void *rcvQue;   // queOptStruct, receive queue.
    int lpType; // 0:sub type, 1:host type
#if CLPTC_CPL_HOST_ENABLE
    void *rcvQue;
    // void *cmdFifo;
    // void *cmdDlg; // clptcDlgItfStc, common cmd sender. set sn,set addr, write/read file
#endif
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
    shmOptInfStc hostSnd;
    // shmOptInfStc hostRcv;
    struct msgOptStct hostRcv;
#endif
} clptcFunItfStc;
#if DEVICE_PLATFORM_CONFIGURE == DEVICE_PLATFORM_LINUX
#define CLPTC_SHM_HOST_SND_KEY (196812260)
#define CLPTC_SHM_HOST_RCV_KEY (101933623)
#endif
enum clptcFunTypeEnum
{
    clptcFunType_Sub = 0,
    clptcFunType_Host,
};
int clptcFunItfInit(clptcFunItfStc *funptr);
int clptcFunCfgDlgMgr(clptcFunItfStc *funptr, void *cfgDlgMgr, uint8_t cfgDnbr, int cfgtype);
int clptcFunGetType(clptcFunItfStc *funptr);
int clptcFunCfgPkrPsr(clptcFunItfStc *funptr, void *cfgPkrPsr, int cfgPsize);
// please write your own code for this function.
int clptcFunItfRcv(clptcFunItfStc *funptr, uint8_t *optbuf, int optlen);
// please write your own code for this function.
int clptcFunItfSnd(clptcFunItfStc *funptr, const uint8_t *optbuf, int optlen);
int clptcFunItfUpdate(clptcFunItfStc *funptr);
#if CLPTC_CPL_HOST_ENABLE
int clptcFunCfgRcvQue(clptcFunItfStc *funptr, void *cfgRcvQue, int qlen);
#endif
#endif